﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LongestDesc.Question;
namespace LongestDesc.Answer
{
    class Jimson : ILongestDesc
    {
        public int GetLongestDesc(int[] iarr)
        {
            int i, j, min, temp, res = 0;
            for (i = 0; i < iarr.Length - 1; i++)
            {
                /* find the minimum */
                min = i;
                for (j = i + 1; j < iarr.Length; j++)
                    if (iarr[j] > iarr[min])
                    {
                        min = j;
                        res++;
                    }
                /* swap data[i] and data[min] */
                temp = iarr[i];
                iarr[i] = iarr[min];
                iarr[min] = temp;

            }

            return iarr.Length- res;
        }


    }
}

